﻿using System;
using DapperExtensions.Mapper;
using Newtonsoft.Json;
using ZLWeb.WebApiEntityBase;
using ZilLion.Service.Core.Domain.EntityBase.JsonConverter;

namespace ZL.CRM.CommonEntity.Common
{
    public class AccInfo : ResponseResultInfo
    {

        /// <summary>
        ///  账户显示名称
        /// </summary>
        public string Accname { get; set; }

        /// <summary>
        ///  账户状态标识（0-正常 2-休眠）
        /// </summary>
        public short Accsta { get; set; }

        /// <summary>
        ///  状态描述
        /// </summary>
        public string Accstasm { get; set; }

        /// <summary>
        ///  卡种id
        /// </summary>
        public int Acccgsid { get; set; }

        /// <summary>
        ///  折扣类别id
        /// </summary>
        public int Accdisid { get; set; }

        /// <summary>
        ///  折扣类别名称(仅用于微信卡包显示等级)（服务端读取缓存获得）
        /// </summary>
        public string Accdismc { get; set; }

        /// <summary>
        ///  折扣类别失效时间(读取缓存)
        /// </summary>
        [JsonConverter(typeof (ChinaDateTimeConverter))]
        public DateTime Accdissxsj { get; set; }

        /// <summary>
        ///  账户余额上限
        /// </summary>
        public decimal Accyueshangx { get; set; }

        /// <summary>
        ///  账户资料：会员性别&手机号码&农历生日&阳历生日
        /// </summary>
        public string Accinfo { get; set; }

        /// <summary>
        ///  账户id加密值
        /// </summary>
        public string Dycardno { get; set; }

        /// <summary>
        ///  操作时间
        /// </summary>
        [JsonConverter(typeof (ChinaDateTimeConverter))]
        public DateTime Doprtime { get; set; }

        /// <summary>
        ///  微信会员卡卡号membershipno
        /// </summary>
        public string Wxcardno { get; set; }

        /// <summary>
        ///  手机号
        /// </summary>
        public string Acccellno { get; set; }

    }

    public class AccInfoMapper : ClassMapper<AccInfo>
    {
        public AccInfoMapper()
        {
            Table("#AccInfo");
            Map(f => f.Accname).Column("Accname");
            Map(f => f.Accsta).Column("Accsta");
            Map(f => f.Accstasm).Column("Accstasm");
            Map(f => f.Acccgsid).Column("Acccgsid");
            Map(f => f.Accdisid).Column("Accdisid");
            Map(f => f.Accdismc).Column("Accdismc");
            Map(f => f.Accdissxsj).Column("Accdissxsj");
            Map(f => f.Accyueshangx).Column("Accyueshangx");
            Map(f => f.Accinfo).Column("Accinfo");
            Map(f => f.Dycardno).Column("Dycardno");
            Map(f => f.Doprtime).Column("Doprtime");
            Map(f => f.Wxcardno).Column("Wxcardno");
            Map(f => f.Acccellno).Column("Acccellno");

        }

    }
}
